using System.ComponentModel;
using DevExpress.XtraEditors;

namespace CosyTrade.UI
{
    public partial class FormBase : XtraForm
    {
        private string moduleKey;
        protected readonly ToolbarCommandCollection toolbarItems = new ToolbarCommandCollection();

        public string ModuleKey
        {
            get { return moduleKey; }
            set { moduleKey = value; }
        }

        public IContainer Components
        {
            get { return components; }
            set { components = value; }
        }

        protected static IOperation Operation
        {
            get { return UI.Operation.Instance; }
        }

        protected static IGlobalInfo GlobalInfo
        {
            get { return UI.GlobalInfo.Instance; }
        }

        public FormBase()
        {
            InitializeComponent();
        }

        public ToolbarCommandCollection ToolbarItems
        {
            get { return toolbarItems; }
        }

        public void RefreshCommandBar()
        {
            BeforeRefreshCommandBar();
        }

        protected virtual void InitCommandBar()
        {
            
        }

        protected virtual void BeforeRefreshCommandBar()
        {
            
        }

        private void FormBase_Load(object sender, System.EventArgs e)
        {
            if (DesignMode) return;

            InitCommandBar();
        }
    }
}